package com.card.hwatt.entity;

import java.util.Date;
import java.util.UUID;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

/**
 * 特殊考勤
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "T_Special")
public class Special {

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "assigned")
	@Column(name = "SpecialID", length = 36)
	@Type(type = "uuid-char")
	public UUID id;

	@Column(name = "`Date`", nullable = false)
	public Date date;

	// @Column(name = "`description`", length = 250)
	// public String description;

	/**
	 * 原因
	 */
	@Column(name = "`Reason`", length = 250)
	public String reason;

	/**
	 * 考勤记录
	 */
	@OneToOne(cascade = { CascadeType.ALL, CascadeType.REMOVE }, fetch = FetchType.EAGER, mappedBy = "special")
	@JoinColumn(nullable = false)
	public Card card;
}
